﻿using AutoMapper;
using PcProject.Domain.IRepository;
using PcProject.Domain.Models.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PcProject.Application.Service.Userss
{
    public class UserService:IUserService
    {
        /// <summary>
        /// 构造函数依赖注入
        /// </summary>
        private IUserRepository _userRepository;
        private IMapper _mapper;
        /// <summary>
        /// 函数依赖注入
        /// </summary>
        /// <param name="productRepository"></param>
        /// <param name="mapper"></param>
        public UserService(IUserRepository userRepository, IMapper mapper)
        {
            _userRepository = userRepository;
            _mapper = mapper;
        }


        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="LoginName">用户名</param>
        /// <param name="LoginPwd">密码</param>
        /// <returns></returns>
        public int Login(string LoginName,string LoginPwd)
        {
            return _userRepository.LoginAsync(LoginName, LoginPwd);
        }


        /// <summary>
        /// 根据Id查询用户
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>
        public List<WeiXinLoginResult> GetUsers(string id)
        {
            return _userRepository.GetUsers(id);
        }

    }
}
